

            


            
using System;
using System.Collections.Generic;
using System.Web;
using System.Linq;
namespace DatabaseComponent
{
     public partial class Ticket
     {

            //Write any additional methods or properties here 
            //Don't modify any genrated classes



         List<TicketImages> _lstTicketImages = null;

         public List<TicketImages> lstTicketImages
         {
             get {

                 if (_lstTicketImages == null)
                 {
                     TicketImagesDB objTicketImagesDB = new TicketImagesDB(ConnectionStrings.LMS);
                     _lstTicketImages = objTicketImagesDB.getTicketImagesByTicketID(ID);
                     _lstTicketImages = new List<TicketImages>(from obj in _lstTicketImages where obj.MessageID <= 0 select obj );

                 }
                 
                 
                 
                                 
                 
                 
                 return _lstTicketImages; }
             
         }





         TicketType _objTicketType = null;

         public TicketType objTicketType
         {
             get {

                 if (_objTicketType == null)
                 {
                     TicketTypeDB objTicketTypeDB = new TicketTypeDB(ConnectionStrings.LMS);

                     List<TicketType> lstTicketType = objTicketTypeDB.getTicketTypeByID(RequestTypeID);

                     if (lstTicketType.Count == 0)
                         return new TicketType();

                     _objTicketType = lstTicketType[0];

                 }
                 
                 
                 
                 
                 return _objTicketType; }
         }



         Persons _objOperator = null;

         public Persons objOperator
         {
             get {

                 if (_objOperator == null)
                 {
                     if (OperatorID == null)
                         return new Persons();


                     PersonsDB objPersonsDB = new PersonsDB(ConnectionStrings.LMS);

                     List<Persons> lstPersons = objPersonsDB.getPersonsByGenID(OperatorID.Value);

                     if (lstPersons.Count == 0)
                         return new Persons();

                     _objOperator = lstPersons[0];



                 }
                 
                 
                 
                 
                 
                 return _objOperator; }
            
         }



         Persons _objOwner = null;

         public Persons objOwner
         {
             get
             {

                 if (_objOwner == null)
                 {
                     


                     PersonsDB objPersonsDB = new PersonsDB(ConnectionStrings.LMS);

                     List<Persons> lstPersons = objPersonsDB.getPersonsByGenID(EmployeeID);

                     if (lstPersons.Count == 0)
                         return new Persons();

                     _objOwner = lstPersons[0];



                 }





                 return _objOwner;
             }

         }





         TicketPeriority _objTicketPeriority = null;

         public TicketPeriority objTicketPeriority
         {
             get {

                 if (_objTicketPeriority == null)
                 {
                     if (PeriorityID == null)
                         return new TicketPeriority();


                     TicketPeriorityDB objTicketPeriorityDB = new TicketPeriorityDB(ConnectionStrings.LMS);

                     List<TicketPeriority> lstTicketPeriority = objTicketPeriorityDB.getTicketPeriorityByID(PeriorityID);

                     if (lstTicketPeriority.Count == 0)
                         return new TicketPeriority();


                     _objTicketPeriority = lstTicketPeriority[0];

                 }
                      
                 
                 return _objTicketPeriority; }
             
         }



         List<TicketMessages> _lstTicketMessages = null;

         public List<TicketMessages> lstTicketMessages
         {
             get {

                 if (_lstTicketMessages == null)
                 {
                     TicketMessagesDB objTicketMessagesDB = new TicketMessagesDB(ConnectionStrings.LMS);
                     _lstTicketMessages = objTicketMessagesDB.getTicketMessagesByTicketID(ID);
                 }
                 
                 
                 
                 
                 
                 return _lstTicketMessages; }
             
         }


         TicketStatus _objTicketStatus = null;

         public TicketStatus objTicketStatus
         {
             get {

                 if (_objTicketStatus == null)
                 {
                     TicketStatusDB objTicketStatusDB = new TicketStatusDB(ConnectionStrings.LMS);
                     List<TicketStatus> lstTicketStatus = objTicketStatusDB.getTicketStatusByID(StatusID);
                     if (lstTicketStatus.Count == 0)
                         return new TicketStatus();

                     _objTicketStatus = lstTicketStatus[0];
                 }
                 
                                 
                 
                 
                 return _objTicketStatus; }
             
         }


         public void clear()
         {
             _objOperator = null;
             _objOwner = null;
             _objTicketPeriority = null;
             _objTicketType = null;
             _lstTicketMessages = null;
             _objTicketStatus = null;
         }



         
     }
}
